package me.winds.wrapper.core.network;

import com.lzy.okgo.callback.StringCallback;
import com.lzy.okgo.model.Response;

import me.winds.wrapper.base.presenter.Callback;

/**
 * Author:  winds
 * Data:    2017/7/1
 * Desc:    响应回调
 */

public class ResponseCallback extends StringCallback {
    public Callback callback;
    public RequestInfo requestInfo;

    public ResponseCallback(Callback callback, RequestInfo requestInfo) {
        this.callback = callback;
        this.requestInfo = requestInfo;
    }

    @Override
    public void onSuccess(Response<String> response) {
        ResponseParser.parseSuccess(response, requestInfo, callback);
    }

    @Override
    public void onError(Response<String> response) {
        super.onError(response);
        ResponseParser.parseError(response, callback);
    }
}
